/**
 * @param {number[]} nums
 * @param {number} k
 * @return {boolean}
*/
var containsNearbyDuplicate = function(nums, k) {
  nums.sort((a, b) => a - b);
  for(let i = 1; i < nums.length; i++) {
    if(nums[i] == nums[i - 1] && Math.abs(i,))
    let val = ;
    if(val <= k) return true;
  }
  return false;
};
let nums = [1,2,3,1], k = 3;
console.log(containsNearbyDuplicate(nums, k));
nums = [1,0,1,1], k = 1;
console.log(containsNearbyDuplicate(nums, k));
nums = [1,2,3,1,2,3], k = 2;
console.log(containsNearbyDuplicate(nums, k));
